import Vue from 'vue'
import VueRouter from 'vue-router'


//首页
import Index from '../views/index/Index.vue'
//首页登录后
import IndexLogin from '../views/index/IndexLogin.vue'
//第二首页
import TIndex from '../views/index/Index1.vue'
//第二首页登陆后
import TindexLogin from '../views/index/TindexLogin.vue'
//企业首页
import Qiye from '../views/index/Qiye.vue'
//企业登录后首页
import QiyeLogin from '../views/index/QiyeLogin.vue'
//企业登录
import Login from '../views/index/Login_Register.vue'
//人才登录
import Login2 from '../views/index/LoginRegister.vue'
//人才首页
import Talent from '../views/index/Talent.vue'
//人才登录后首页
import TalentLogin from '../views/index/TalentLogin.vue'
//通知页
import Inform from '../views/index/Inform.vue'
//通知登录页
import InformLogin from '../views/index/InformLogin.vue'
//平台登录
import AllLogin from '../views/index/AllLogin.vue'
//专家登录
import ZjLogin from '../views/index/zjLogin.vue'


// 个人

import Nav from '../views/personal/person/Nav.vue'
import Tree from '../components/personal/person/Tree.vue'
import Skill from '../components/personal/person/Skill.vue'
import Evaluation from '../components/personal/person/Evaluation.vue'
import Resume from '../components/personal/person/Resume.vue'
import Collect from '../components/personal/person/Collect.vue'
import User from '../components/personal/person/User.vue'
import PersonInfo from '../views/personal/person/PersonInfo.vue'
import Train from '../components/personal/person/Train.vue'
import Grow from '../components/personal/person/Grow.vue'
import Education from '../components/personal/person/Education.vue'
import Work from '../components/personal/person/Work.vue'
import Pay from '../components/personal/person/Pay.vue'
import Skill1 from '../components/personal/person/Skill1.vue'
import Manage1 from '../components/personal/person/Manage1.vue'
import Binding from '../components/personal/person/Binding.vue'
import login from '../views/LoginRegister.vue'

// 企业
import LoginRegister from '../views/company/LoginRegister'
import Fe from '../views/company/Fe'
import Recruit from '../components/company/Recruit'
import Basic from '../components/company/Basic'
import Big from '../components/company/Big'
import Money from '../components/company/Money'
import Interview from '../components/company/Interview'
import Look from '../components/company/Look'
import Pmanage from '../components/company/Pmanage'
import Tname from '../components/company/Tname'
import Start from '../components/company/Start'


// 公司
import Cybe from '../views/parent/Cybe';
import Pfmtkb from "../components/parent/Pfmtkb";
import Eepwmn from "../components/parent/Eepwmn";
import Eeaymt from "../components/parent/Eeaymt";
import Remt from "../components/parent/Remt";
import Bsmt from "../components/parent/Bsmt";
import Etmt from "../components/parent/Etmt";
import Flmt from "../components/parent/Flmt";
import Ncmt from "../components/parent/Ncmt";

import Neeatnr from "../components/parent/Neeatnr";
import Rwcsore from "../components/parent/Rwcsore";
import Epaton from "../components/parent/Epaton";
import Nwetat from "../components/parent/Nwetat";
import Etqncn from "../components/parent/Etqncn";
import Nwne from "../components/parent/Nwne";

// 专家
import Zj from '../views/professor/Zj';
import Professor_gzjl from "../components/professor/professor_gzjl";
import Professor_pxjl from "../components/professor/professor_pxjl";
import Professor_kb from "../components/professor/professor_kb";
import Professor_jlpg from "../components/professor/professor_jlpg";
import Professor_zyjn from "../components/professor/professor_zyjn";
import Professor_zjxx from "../components/professor/professor_zjxx";
import Professor_jyjl from "../components/professor/professor_jyjl";
import Professor_zjjyjl from "../components/professor/professor_zjjyjl";
import Professor_zjgzjy from "../components/professor/professor_zjgzjy";
import Professor_jlxq from "../components/professor/professor_jlxq";

Vue.use(VueRouter)

const routes = [
  // 首页
  {
    path: '/',
    redirect:'/index',
  },
  {
    path: '/index',
    name: 'Index',
    component: Index,
  },
  {
    path: '/indexLogin',
    name: 'IndexLogin',
    component: IndexLogin,
  },
  {
    path: '/zjLogin',
    name: 'ZjLogin',
    component: ZjLogin,
  },
  {
    path: '/alllogin',
    name: 'AllLogin',
    component: AllLogin,
  },
  {
	  path:'/indexTlogin',
	  name:'TindexLogin',
	  component:TindexLogin,
  },
  {
    path: '/indexT',
    name: 'TIndex',
    component: TIndex,
  },
  
  {
    path: '/QiyeLogin',
    name: 'QiyeLogin',
    component: QiyeLogin,
  },
  {
    path: '/talent',
    name: 'Talent',
    component: Talent,
  },
  {
    path: '/TalentLogin',
    name: 'TalentLogin',
    component: TalentLogin,
  },
  {
    path: '/Inform',
    name: 'Inform',
    component: Inform
  },
  {
    path: '/InformLogin',
    name: 'InformLogin',
    component: InformLogin
  },
  
  {
    path: '/l',
    name: 'l',
    component: Login,
  },
  {
    path: '/log',
    name: 'log',
    component: Login2,
  },
  {
    path: '/qiye',
    name: 'Qiye',
    component: Qiye,
  },
  // 个人

  {
    path: '/login/nav',redirect: '/login/nav/information',
    // name: 'Nav',
    component:Nav,
    children: [
      {
        path:'/login/nav/user',
        component:User
      },
      {
        path:'/login/nav/information',
        component:PersonInfo
      },
      {
        path:'/login/nav/tree',
        component:Tree
      },
      {
        path:'/login/nav/skill',
        component:Skill
      },
      {
        path:'/login/nav/evaluation',
        component:Evaluation
      },
      {
        path:'/login/nav/resume',
        component:Resume
      },
      {
        path:'/login/nav/collect',
        component:Collect
      },
      {
        path:'/login/nav/work',
        component:Work
      },
      {
        path:'/login/nav/pay',
        component:Pay
      },
      {
        path:'/login/nav/education',
        component:Education
      },
      {
        path:'/login/nav/train',
        component:Train
      },
      {
        path:'/login/nav/grow',
        component:Grow
      },
      {
        path:'/login/nav/skill1',
        component:Skill1
      },
      {
        path:'/login/nav/manage1',
        component:Manage1
      },
      {
        path:'/login/nav/binding',
        component:Binding
      },
    ]
  },
  
  {
    path: '/login',
    name: 'Login',
    component:login
  },
  // 企业
  {
    path: '/loginregister',
    component: LoginRegister
  },
  {
    path: '/fe',
    name: 'Fe',
    component: Fe,
    redirect:'/Start',
    children: [
      {
        path:'/start',
        component:Start
      },
      {
        path: '/recruit',
        component: Recruit
      },
      {
        path: '/look',
        component: Look
      },
      {
        path: '/basic',
        component: Basic
      },
      {
        path: '/big',
        component: Big
      },
      {
        path: '/tname',
        component: Tname
      },
      {
        path: '/money',
        component: Money
      },
      {
        path: '/pmanage',
        component: Pmanage
      },
      {
        path: '/interview',
        component: Interview
      }
    ]
  },

  // 公司
  {
    path: '/cybe',
    name: 'Cybe',
    component: Cybe,
    children:[
      {
        path: '/pfmtkb',
        name: 'Pfmtkb',
        component: Pfmtkb
      },
      {
        path: '/eepwmn',
        name: 'Eepwmn',
        component: Eepwmn
      },
      {
        path: '/eeaymt',
        name: 'Eeaymt',
        component: Eeaymt,

      },{
        path:'/neeatnr',
        name:'Neeatnr',
        component:Neeatnr
      },
      {
        path: '/remt',
        name: 'Remt',
        component: Remt,
      },{
        path:'/rwcsore',
        name:'Rwcsore',
        component:Rwcsore
      },
      {
        path: '/bsmt',
        name: 'Bsmt',
        component: Bsmt,
      },{
        path:'/epaton',
        name:'Epaton',
        component:Epaton
      },
      {
        path: '/etmt',
        name: 'Etmt',
        component: Etmt,
      },  {
        path:'/nwetat',
        name:'Nwetat',
        component:Nwetat
      },
      {
        path:'/etqncn',
        name:'Etqncn',
        component:Etqncn
      },
      {
        path: '/flmt',
        name: 'Flmt',
        component: Flmt
      },
      {
        path: '/ncmt',
        name: 'Ncmt',
        component: Ncmt,
      },{
        path:'/nwne',
        name:'Nwne',
        component:Nwne
      },
    ]
  },
  // 专家
  {
    path: '/zj',
    name: 'Zj',
    component: Zj,
    children:[
      {
        path:'/professor_gzjl',
        name:'Professor_gzjl',
        component:Professor_gzjl
      },{
        path:'/professor_pxjl',
        name:'Professor_pxjl',
        component:Professor_pxjl
      },{
        path:'/professor_kb',
        name:'Professor_kb',
        component:Professor_kb
      },{
        path:'/professor_jlpg',
        name:'Professor_jlpg',
        component:Professor_jlpg
      },{
        path:'/professor_zyjn',
        name:'Professor_zyjn',
        component:Professor_zyjn
      },{
        path:'/professor_zjxx',
        name:'Professor_zjxx',
        component:Professor_zjxx
      },{
        path:'/professor_jyjl',
        name:'Professor_jyjl',
        component:Professor_jyjl
      },{
        path:'/professor_zjjyjl',
        name:'Professor_zjjyjl',
        component:Professor_zjjyjl
      },{
        path:'/professor_zjgzjy',
        name:'Professor_zjgzjy',
        component:Professor_zjgzjy
      },{
        path:'/professor_jlxq',
        name:'Professor_jlxq',
        component:Professor_jlxq
      }
    ]
  },

]



// 连上后端之后的写法  连上之后再用  不然  我写不了页面
// const routes = [new router(
//   {
//     path:'/conpage',
//     component:Conpage
//   },
//   {
//     path: '/login',
//     component: Login
//   },
//   {
//     path: '/fee',
//     component: Fee
//   },
// ],
// )



const router = new VueRouter({
  mode: 'history',//history hash
  base: process.env.BASE_URL,
  routes
})


//挂载路由导航守卫
router.beforeEach((to,from,next)=>{
  // to将要访问的路径
  //from 代表从那个路径跳转而来
  //next 是一个函数，表示放行
  //next()放行  next('/login')强制跳转
  if(to.path==='/index') return next();
  if(to.path === '/log') return next();
  // 获取token
  const tokenStr = window.sessionStorage.getItem('token')
  if(!tokenStr) return next('/log')
  next()
})



export default router
